package behavior.strategy;

/**
 * @author dali
 * @date 2021-07-29 10:45
 * @Description 打车
 */

public class ByTaxi implements Strategy{
    //超过起步价每公里价格
    private final static int TAXI_FEE = 2;
    //起步价格
    private final static int TAXI_START = 5;
    //起步距离
    private final static int TAXI_DISTANCE = 3;
    @Override
    public int calFee(int distance) {
        return distance <= TAXI_DISTANCE ? TAXI_START : TAXI_START + (distance-TAXI_DISTANCE) * TAXI_FEE;
    }
}
